/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package trade;

import java.util.Arrays;
import java.util.Collection;
import org.junit.runners.Parameterized;
import org.junit.runner.RunWith;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.theories.Theories;
import static org.junit.Assert.*;

/**
 *
 * @author Leo
 */
@RunWith(value = Theories.class)
public class NegocioTestClasseEquivalenciaParameterized {

    private String acao;
    private Integer quantidade;
    private String exceptionMessage;

    public NegocioTestClasseEquivalenciaParameterized(String acao, Integer quantidade, String exceptionMessage) {
        this.acao = acao;
        this.quantidade = quantidade;
        this.exceptionMessage = exceptionMessage;
    }

    @Parameterized.Parameters
    public static Collection<Object[]> data() {
        Object[][] data = new Object[][]{
            {"C", 20, "Símbolo"},
            {"AA", -5, "Quantidade"},};
        return Arrays.asList(data);
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() {
    }

    @After
    public void tearDown() {
    }

    @Test
    public void pushTest() {
        Negocio negocio = new Negocio();

        try {
            negocio.compra(acao, quantidade);
            fail();
        } catch (NegocioException ex) {
            assertTrue(ex.getMessage().contains(exceptionMessage));
            assertFalse(negocio.contemAcao(acao));
        }
    }

}